﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Media.Imaging;
using WebPaigeDesign.Utilities;


namespace EggOfPanKu.Library.Infrastructure
{
    public static class ImageManager
    {
        public static BitmapImage GenerateImageSource(string path)
        {
            BitmapImage bmpImage = new BitmapImage();
            //Load Image
            try
            {
                bmpImage.BeginInit();
                bmpImage.UriSource = new Uri(path);
                bmpImage.EndInit();
                return bmpImage;
            }
            catch (Exception ex)
            {
                LogManager.Write(LogManager.Level.WARN, String.Format("Error Loading '{0}': {1}", path, ex.Message), "ImageManager::GenerateImageSource");
                BitmapImage bmpError = new BitmapImage();
                //bmpError.BeginInit();
                //bmpError.UriSource = new Uri(System.IO.Path.Combine(ConfigManager.AppSettingsMgr.ExecutingAssemblyPath, @"images\cards\card_error.jpg"));
                //bmpError.EndInit();
                return bmpError;
            }

            
        }
    }
}
